<?php
/**
 * Created by PhpStorm.
 * User: yangyou
 * Date: 2019/1/14 0014
 * Time: 10:32
 */

namespace app\index\model;


class ColumnPage extends Base
{
    /**
     * Author:yang you
     * Time:2018-01-14 10:27:51
     * Describe:关于我们列表
     * @return int|string
     */
    public function columnPageList($substation_id="1",$parent_id =""){
        return $this->alias('a')->field('page_id,page_name')
            ->where(function ($q)use ($parent_id){
                if($parent_id==0){
                    $q->where("parent_id",0);
                }else{
                    $q->where("parent_id",$parent_id);
                }
            })
            ->where("delete",0)
            ->where("substation_id",$substation_id)
            ->orderRaw("sort desc")
            ->select();
    }

    /**
     * Author:yang you
     * Time:2018-01-14 10:27:51
     * Describe:关于我们子类列表
     * @return int|string
     */
    public function childrenColumnList($substation_id="1"){
        return $this->alias('a')->field('page_id,page_name')
            ->where("parent_id != 0")
            ->where("delete",0)
            ->where("substation_id",$substation_id)
            ->orderRaw("sort desc")
            ->select();
    }


}